
<link rel="shortcut  icon" type="image/x-icon" href="img/icon/favicon.ico" media="screen">
<!-- 框架样式 -->
<link type="text/css" rel="stylesheet" href="${static}/fonts/font-icons.min.css">
<link type="text/css" rel="stylesheet" href="${static}/css/bootstrap.min.css">
<link type="text/css" rel="stylesheet" href="${static}/plugin/layui/css/layui.css">
<link type="text/css" rel="stylesheet" href="${static}/plugin/datatable/media/css/dataTables.bootstrap.min.css">
<link type="text/css" rel="stylesheet" href="${static}/plugin/bootstrap-select/css/bootstrap-select.min.css?r=0.020456797551074324">
<link rel="stylesheet" type="text/css" href="${static}/plugin/bootstrap-datetimepicker-master/css/bootstrap-datetimepicker.css">
<link type="text/css" rel="stylesheet" href="${static}/plugin/radioCheckBox/src/pretty.min.css">
<link type="text/css" rel="stylesheet" href="${static}/plugin/materialdesignicons/css/materialdesignicons.min.css">
<link async rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/material-design-iconic-font/2.2.0/css/material-design-iconic-font.min.css"/>
<link type="text/css" rel="stylesheet" href="${static}/plugin/radioCheckBox/src/pretty.min.css">
<link type="text/css" rel="stylesheet" href="${static}/plugin/drag/drag.css">
<link type="text/css" rel="stylesheet" href="${static}/plugin/calendar/simple-calendar.css">
<link type="text/css" rel="stylesheet" href="${static}/plugin/weather/leoweather.css">
<link rel="stylesheet" type="text/css" href="${static}/plugin/imgupload/css/cropper.min.css?r=0.6207188189209538">
<link rel="stylesheet" type="text/css" href="${static}/plugin/imgupload/css/mui.min.css?r=0.9207463414125734">
<link type="text/css" rel="stylesheet" href="${static}/plugin/jquery-plugin-circliful-master/css/jquery.circliful.css">

<!-- 自定义样式 -->
<link type="text/css" rel="stylesheet" href="${static}/css/fream.css"> <!-- 顶部和侧边 -->
<link type="text/css" rel="stylesheet" href="${static}/css/iconfont.css">
<link type="text/css" rel="stylesheet" href="${static}/css/main.css?r=0.4389791385058335">
<link type="text/css" rel="stylesheet" href="${static}/css/nav.css">
<link rel="stylesheet" type="text/css" href="${static}/css/processHelper.css?r=0.07160859914374484">
<link type="text/css" rel="stylesheet" href="${static}/css/dtable.css">
<link type="text/css" rel="stylesheet" href="${static}/page/back/firstpage/css/firstpage.css"><!-- 主页css -->
<link type="text/css" rel="stylesheet" href="${static}/css/btn.css">
<link type="text/css" rel="stylesheet" href="${static}/page/back/device/css/icon.css">

<link type="text/css" rel="stylesheet" href="${static}/page/back/customprint/file/cpTemple.css">
<link type="text/css" rel="stylesheet" href="${static}/js/utils/listRight/listRight.css">
<link type="text/css" rel="stylesheet" href="${static}/plugin/checkBox/dist/checkbox.min.css">
<link type="text/css" rel="stylesheet" href="${static}/page/back/maintainRecord/swiper/swiper.min.css">
<link type="text/css" rel="stylesheet" href="${static}/js/utils/slider/slider.css">
<link type="text/css" rel="stylesheet" href="${static}/plugin/select2-develop/dist/css/select2.min.css">
<link type="text/css" rel="stylesheet" href="${static}/plugin/wdScrollTab/css/TabPanel.css?V4.1-03082101">
<link type="text/css" rel="stylesheet" href="${static}/css/adminlte.min.css">
<link type="text/css" rel="stylesheet" href="${static}/css/common.css">




<script type="text/javascript" src="${static}/js/jquery.min.js"></script>
<script type="text/javascript" src="${static}/js/bootstrap.min.js"></script>
<script type="text/javascript" src="${static}/plugin/layer/layer.js"></script>
<script type="text/javascript" src="${static}/plugin/layui/layui.js"></script>
<script type="text/javascript" src="${static}/plugin/countdown/countdown.js"></script>
<script type="text/javascript" src="${static}/js/i-jquery.js?r=85145"></script>
<script type="text/javascript" src="${static}/js/main.js?v=123"></script>
<script type="text/javascript" src="${static}/js/imgClickBig.js"></script>
<script type="text/javascript" src="${static}/js/jquery.cookie.min.js?v=123456"></script>
<script type="text/javascript" src="${static}/plugin/datatable/media/js/jquery.dataTables.js"></script>
<script type="text/javascript" src="${static}/plugin/datatable/media/js/dataTables.bootstrap.js"></script>
<script type="text/javascript" src="${static}/js/jquery.timeago.js"></script>
<script type="text/javascript" src="${static}/js/jquery.form.js"></script>
<script type="text/javascript" src="${static}/plugin/bootstrap-select/js/bootstrap-select.js"></script>
<script type="text/javascript" src="${static}/plugin/drag/drag.js"></script>
<script type="text/javascript" src="${static}/plugin/calendar/simple-calendar.js"></script>
<script type="text/javascript" src="${static}/plugin/weather/jquery.leoweather.min.js"></script>
<script type="text/javascript" src="${static}/js/material-decomposition.js?r=123sdf"></script>
<script type="text/javascript" src="${static}/js/processHelper.js?r=324242"></script>
<script type="text/javascript" src="${static}/js/checkGroup.js?r=85145"></script>
<script type="text/javascript" src="${static}/js/iDistpicker.js?r=85145"></script>
<script type="text/javascript" src="${static}/plugin/bootstrap-datetimepicker-master/js/bootstrap-datetimepicker.js"></script>
<script type="text/javascript" src="${static}/plugin/bootstrap-datetimepicker-master/js/locales/bootstrap-datetimepicker.zh-CN.js"></script>
<script type="text/javascript" src="${static}/js/pmHelper.js"></script>
<script type="text/javascript" src="${static}/js/formUtil.js"></script>
<script type="text/javascript" src="${static}/js/layer-date-format.js"></script>
<script type="text/javascript" src="${static}/js/dateUtil.js"></script>
<script type="text/javascript" src="${static}/js/iUpload.js"></script>
<script type="text/javascript" src="${static}/plugin/eachrt4.1/echarts.js"></script>
<script type="text/javascript" src="${static}/plugin/jquery-plugin-circliful-master/js/jquery.circliful.js"></script>
<script type="text/javascript" src="${static}/plugin/utils/numberUtils.js"></script>
<script type="text/javascript" src="${static}/js/checkWindowClose.js"></script>
<script type="text/javascript" src="${static}/js/utils/common/fileUtils.js"></script>
<script type="text/javascript" src="${static}/js/utils/common/arrayUtils.js"></script>
<script type="text/javascript" src="${static}/js/utils/common/arrayUtils.js"></script>
<script type="text/javascript" src="${static}/js/utils/common/formUtil.js"></script>
<script type="text/javascript" src="${static}/js/utils/common/layer-tip.js"></script>

<script type="text/javascript" src="${static}/plugin/select2-develop/dist/js/select2.js"></script>
<script type="text/javascript" src="${static}/plugin/select2-develop/dist/js/pinyin.js"></script>

<!-- 生成二维码-->
<script type="text/javascript" src="${static}/plugin/qrcode/jquery.qrcode.js"></script>
<script type="text/javascript" src="${static}/plugin/qrcode/qrcode.js"></script>
<script type="text/javascript" src="${static}/plugin/qrcode/utf.js"></script>
<script type="text/javascript" src="${static}/plugin/JsBarcode-master/dist/JsBarcode.all.js"></script>

<!-- 树插件 -->
<link rel="stylesheet" href="${static}/plugin/ztree/zTreeStyle/zTreeStyle.css" />
<script type="text/javascript" src="${static}/plugin/ztree/jquery.ztree.all-3.5.min.js"></script>
<script type="text/javascript" src="${static}/js/PullDownTreeUtil2.js"></script>
<script src="${static}/plugin/jsPlumb/js/jsplumb.js"></script>
<script src="${static}/plugin/jsPlumb/flowchart-util.js"></script>

<script src="${static}/js/utils/listRight/listRightUtil.js"></script>
<script src="${static}/js/utils/checkUtils/checkUtils.js"></script>
<script src="${static}/page/back/patrolStatic/js/utils.js"></script>
<script src="${static}/js/utils/slider/slider.js"></script>
<script src="${static}/page/back/shuju/js/fullscreen.js"></script>
<script src="${static}/page/back/maintainRecord/swiper/swiper.min.js"></script>

<script  src="${static}/plugin/datatable/JSZip-2.5.0/jszip.min.js"></script>
<script  src="${static}/plugin/datatable/pdfmake-0.1.36/pdfmake.min.js"></script>
<script  src="${static}/plugin/datatable/Buttons-1.5.6/js/dataTables.buttons.js"></script>
<script  src="${static}/plugin/datatable/Buttons-1.5.6/js/buttons.flash.min.js"></script>
<script  src="${static}/plugin/datatable/Buttons-1.5.6/js/buttons.html5.js"></script>
<script  src="${static}/plugin/datatable/Buttons-1.5.6/js/buttons.print.js"></script>
<script  src="${static}/js/utils/table2excel/table2excel.js"></script>
<script  src="${static}/js/common.js"></script>
<!--<script  src="${static}/js/sysIndex.js"></script>-->

<link type="text/css" rel="stylesheet" href="${static}/page/back/maintainPlan/css/maintainPlan.css">
<style type="text/css">
    .div-main{
        min-width:1660px;
    }
    .chooseRow {
        background-color: #fefeca !important;
    }

</style>
<div class="page-content-s">
    <div class="oper-search">
        <form class="form-inline">
            <div class="form-group">
                <label>类别：</label>
                <input id="textVague" name ="textVague" type="text" class="form-control search-cache" placeholder="请输入类别" autocomplete="off"/>
            </div>
            <div class="form-group">
                <label>编码：</label>
                <input id="codeVague" name ="codeVague" type="text" class="form-control search-cache" placeholder="请输入编码" autocomplete="off"/>
            </div>
            <div class="form-group">
                <label>名称：</label>
                <input id="nameVague" name = "nameVague" type="text" class="form-control search-cache" placeholder="请输入名称" autocomplete="off"/>
            </div>
            <div class="form-group">
                <span class="btn btn-sm glyphicon glyphicon-search" onclick="searchBtn()">搜索</span>
            </div>
            <div class="form-group">
                <a href="${ctx}/codeReason/add" title="添加原因码" class="btn btn-sm glyphicon glyphicon-plus"  data-click-binded="true" power="MaintainPlanController.add" powertype="1" onclick="add(this);return false;">添加</a>
                <span class="btn btn-sm glyphicon glyphicon-import"  onclick="importExcel()">导入</span>
                <span class="btn btn-sm glyphicon glyphicon-export" onclick="exportPlan()">导出</span>
            </div>
            <input type="text" id="delFlag" name="delFlag" value="0" hidden>
        </form>
    </div>
    <div class="data-list">
        <table class="dtable Main_dtable">
            <thead>
            <tr>
                <th style="min-width: 100px;">类别</th>
                <th style="min-width: 100px">编码</th>
                <th style="min-width: 60px">名称</th>
                <th style="min-width: 60px">说明</th>
                <th style="min-width: 60px">状态</th>
                <th style="min-width: 60px">创建人</th>
                <th style="min-width: 60px">创建时间</th>
                <th style="min-width: 60px">修改人</th>
                <th style="min-width: 60px">修改时间</th>
                <th style="width:200px">操作</th>
            </tr>
            </thead>
            <tbody>
            </tbody>
        </table>
    </div>
</div>
<!-- 右边侧滑 -->
<div class="rightdata" style="background-color:#FFFFFF;z-index:19960312;"></div>
<script src="${static}/js/excelImportHelper.js"></script>
<iframe class="exportIframe" style="border: none; width: 0; height: 0"></iframe>
<script>
    function getSearchPara() {
        var textVague = $("#textVague").val().trim();
        var codeVague = $("#codeVague").val().trim();
        var nameVague = $("#nameVague").val().trim();
        var param = 'textVague='+textVague+'&codeVague='+codeVague+'&nameVague='+nameVague;
        return param;
    }

    function getSearchUrl(){
        var url = '${ctx}/codeReason/codeReasonPageInfo?' + getSearchPara();
        url = encodeURI(url);
        return url;
    }

    //注意：选项卡 依赖 element 模块，否则无法进行功能性操作
    var table = dataTable = $(".Main_dtable");
    $(function() {
        sys.useSimpleRetrieveData();
        var staticPrefix = "${static}";
        var config = sys.DynamicDatabeConfig(staticPrefix,getSearchUrl(), [ /*{
            data : null,
            render : function(data, type, full, meta){
                return meta.row + 1 + meta.settings._iDisplayStart; }
        },*/
            {
                data : 'dictText'
            },
            {
                data : 'code'
            },
            {
                data : 'name',
            },
            {
                data : 'remark'
            },
            {
                data : 'delFlag',
                render:function(row, type, data, meta){
                    if(data.delFlag==0){
                        return "<span class='badge bg-green'>"+'未删除'+"</span>";
                    }else{
                        return "<span class='badge bg-red'>"+'已删除'+"</span>";
                    }

                }
            },
            {
                data : 'createUser'
            },
            {
                data : 'createTime'
            },
            {
                data : 'updateUser',
            },
            {
                data : 'updateTime'
            },
            {
                data : null,
                render : function(data) {
                    //console.log("data:"+data.id,data.delFlag)
                    return getOperHtml(data.id,data.delFlag);
                }
            },
        ],true, {ordering:true});
        //禁止排序
        config.bSort=false;
        config.default
        config.aLengthMenu = [10,20,50,100];
        dataTable.dataTable(config).api();
    })



    function searchBtn(){
        dataTable.api().ajax.url(getSearchUrl()).load(null, false).draw();
    }
    function getOperHtml(id,deleteStatus){
        var  html = '';
        if(deleteStatus ==0){
            html += '<a  href="${ctx}/codeReason/edit"  title="修改原因码" powertype="1" class="btn glyphicon glyphicon-pencil btn-xs" onclick="edit(this,\''+id+'\');return false;">修改</a>&nbsp;';
            html += '<a class="btn glyphicon glyphicon-trash btn-xs" onclick="del(\''+id+'\')">删除</a>';
        }
        return html;
    }

    // 添加原因码
    function add(obj) {
        var $this = $(obj);
        var url = $this.data("href") || $this.attr("href");
        var title = $this.data("title") || $this.attr("title");
        js.addTabPage($this,title,url,true,true);
    }

    // 编辑原因码
    function edit(obj,id) {
        //console.log("id："+id);
        var $this = $(obj);
        var url = $this.data("href") || $this.attr("href")+"?id="+id;
        var title = $this.data("title") || $this.attr("title");
        js.addTabPage($this,title,url,true,true);
    }
    //删除备件档案
    function del(id) {
        sys.confirm("确定删除该数据吗？", confirmdel);
        function confirmdel() {
            sys.getApiData("${ctx}/codeReason/del", {
                id : id
            }, back, "post");
            function back(data) {
                debugger;
                if (data.code == 0) {
                    data.url="${ctx}/codeReason/list";
                }
                dataTable.api().ajax.url(getSearchUrl()).load(null, false).draw();
                // parent.dataTable.api().ajax.reload(null,false);
            }
        }
    }
    function reload(){
        dataTable.dataTable().api().draw();
    }
</script>
<div id="listRightContent"></div>
